//
//  QDMainViewController.m
//  QuickDoctor
//
//  Created by Eric on 2016-12-20.
//  Copyright © 2016 Eric. All rights reserved.
//

#import "QDMainViewController.h"
#import "QDWeatherView.h"
#import "QDFamousDoctorView.h"
#import "QDCycleView.h"


@interface QDMainViewController ()<SDCycleScrollViewDelegate>

@end

@implementation QDMainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    [self setupUI];
}

#pragma mark
#pragma mark - 搭建界面
- (void)setupUI
{
    //title
    self.title = @"马医一生";
    //0	205	200
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0/255.0 green:205/255.0 blue:200/255.0 alpha:1];

    #pragma mark -- 1.天气
    QDWeatherView *weatherView = [QDWeatherView weatherView];
    [self.view addSubview:weatherView];
    QDCycleView *cycleScrollView = [[QDCycleView alloc] initWithFrame:CGRectZero];
    
    [self.view addSubview:cycleScrollView];

    
    #pragma mark -- 3.名医通
    QDFamousDoctorView *famousDoctorV = [[QDFamousDoctorView alloc]initWithFrame:CGRectMake(0, 310, 375, 370)];
    famousDoctorV.backgroundColor = [UIColor colorWithRed:188 / 255.0 green:246 / 255.0 blue:255 / 255.0 alpha:1];
    [self.view addSubview:famousDoctorV];
    
    //设置约束
    //天气
    [weatherView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.mas_equalTo(self.view);
        make.top.mas_equalTo(self.mas_topLayoutGuideBottom);
        make.height.mas_equalTo(80);
    }];
    
    //轮播器
    [cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.mas_equalTo(self.view);
        make.top.mas_equalTo(weatherView.mas_bottom);
        make.height.mas_equalTo(210);
    }];
    
    //名医通
    [famousDoctorV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(self.view);
        make.top.mas_equalTo(cycleScrollView.mas_bottom);
        make.bottom.mas_equalTo(self.view);
    }];
}

@end
